import fetch from '@/utils/fetch'

export function uploadfile(fileobj) {
  let param = new FormData()
  param.append('file', fileobj.file)
  param.append('file_type', fileobj.file_type)
  return fetch({
    url: '/import-excel/',
    method: 'POST',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: param
  })
}

export function getDatalist(id) {
  return fetch({
    url: `/show-table-data/?file_type=${id}`,
    method: 'POST',
    data: { 'file_type': id }
  })
}

export function deleteById(id) {
  return fetch({
    url: `/clear-table/?file_type=${id}`,
    method: 'POST',
    data: { 'file_type': id }
  })
}